package com.bw.hongye.other.controller;

import com.aliyun.common.utils.PageUtils;
import com.aliyun.common.utils.R;
import com.bw.hongye.other.entity.AssortEntity;
import com.bw.hongye.other.service.AssortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author tZhe
 * @email tZhe@hongye.com
 * @date 2021-07-16 21:54:41
 */
@RestController
@RequestMapping("other/assort")
public class AssortController {
    @Autowired
    private AssortService assortService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = assortService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{assortId}")
    public R info(@PathVariable("assortId") Long assortId){
		AssortEntity assort = assortService.getById(assortId);

        return R.ok().put("assort", assort);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody AssortEntity assort){
		assortService.save(assort);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AssortEntity assort){
		assortService.updateById(assort);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] assortIds){
		assortService.removeByIds(Arrays.asList(assortIds));

        return R.ok();
    }

}
